package com.atguigu.srb.core.controller.api;


import com.atguigu.common.result.Result;
import com.atguigu.srb.core.pojo.entity.Dict;
import com.atguigu.srb.core.service.DictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 数据字典 前端控制器
 * </p>
 *
 * @author ZLHao
 * @since 2021-07-12
 */
@Api(tags = "前台展示数据字典")
@RestController
@Slf4j
@RequestMapping("/api/core/dict")
public class DictController {

    @Autowired
    private DictService dictService;

    
    /** 
     * @description: 根据Code查询数据字典 
     * @param: dictCode 
     * @return: com.atguigu.common.result.Result 
     * @author Administrator
     * @date: 2021/7/20 0020 19:19
     */ 
    @ApiOperation("根据类型查询子数据")
    @GetMapping("/findByDictCode/{dictCode}")
    public Result findByDict(
            @ApiParam("类型")
            @PathVariable String dictCode){

        List<Dict> dictList = dictService.findByDictCode(dictCode);
        return  Result.ok().data("dictList",dictList);
    }

}

